<?php

// Carga de clases
//require_once ("./classes/C_krn_tools.php");
//require_once ("./classes/C_krn_session.php");
require_once ("./classes/html.class.php");
//require_once ("./classes/web.class.php" );

// Menu principal
class c_main {
	// Evitamos el clonaje del objeto. Patron Singleton
	private function __clone() {
	}
	private function __wakeup() {
	}
	private static $_instance;
	public static function getInstance() {
		if (! (self::$_instance instanceof self)) {
			self::$_instance = new self ();
		} // !( self::$_instance instanceof self )
		return self::$_instance;
	}
	function __construct() {

		global $cAUDIT;
		$cAUDIT->AddAudit ( AUDIT_EXTEND, __DIR__, __FILE__, __LINE__, __CLASS__, __METHOD__, __FUNCTION__, "::constructor (" . __CLASS__ . ")" );
	}
	public function Main() {
		global $cHTML;
		global $IDIOMA, $language;
		global $BD;
		global $cAUDIT;
		global $s;
		global $cUTIL;
		
		// ¿está logueado?
		$LOGIN = $s->getEstaLogeado ();
		
		// log
		$cAUDIT->AddAudit ( AUDIT_APP, __DIR__, __FILE__, __LINE__, __CLASS__, __METHOD__, __FUNCTION__, $language [$IDIOMA] [3] );
		
		// Obtenemos los datos del dispositivo
		$cUTIL->getDEVICE ();
		
		// Cargamos la web
		// $HTML_web = $cHTML_web->getHTML_web ( $LOGIN );
		
		// Cargamos la pagina principal
		$HEADER = '';
		// $CENTRAL = '<form id="FORMULARIO_GENERAL"></form>';
		$CENTRAL = '';
		$FOOTER = '';
		
		// Cuerpo de la web
		$HTML = '';
		
		// Generar HTML
		$HTML = $cHTML->getHTML ( $HEADER, $CENTRAL, $FOOTER, $LOGIN, $BD->Counter ( NON_GRAFICAL_COUNTER ) );
		
		// Mostrar HTML
		echo $HTML;
	}
}
;

// Instancia de la clase
try {
	$main = c_main::getInstance ();
	$main->Main ();
} catch ( Exception $e ) {
	global $cAUDIT;
	global $IDIOMA, $language;
	
	$cAUDIT->AddAudit ( AUDIT_EXTEND, __DIR__, __FILE__, __LINE__, __CLASS__, __METHOD__, __FUNCTION__, $language [$IDIOMA] [2] . $e->getMessage () );
}

?>
